<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link href="http://search.cpan.org/s/style.css" rel="stylesheet" type="text/css">
<title>RhumbSolve(1)</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>



<h1 id="NAME">NAME</h1>

<p>RhumbSolve -- perform rhumb line calculations</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<p><b>RhumbSolve</b> [ <b>-i</b> | <b>-L</b> <i>lat1</i> <i>lon1</i> <i>azi12</i> ] [ <b>-e</b> <i>a</i> <i>f</i> ] [ <b>-d</b> | <b>-:</b> ] [ <b>-w</b> ] [ <b>-p</b> <i>prec</i> ] [ <b>-s</b> ] [ <b>--comment-delimiter</b> <i>commentdelim</i> ] [ <b>--version</b> | <b>-h</b> | <b>--help</b> ] [ <b>--input-file</b> <i>infile</i> | <b>--input-string</b> <i>instring</i> ] [ <b>--line-separator</b> <i>linesep</i> ] [ <b>--output-file</b> <i>outfile</i> ]</p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>The path with constant heading between two points on the ellipsoid at (<i>lat1</i>, <i>lon1</i>) and (<i>lat2</i>, <i>lon2</i>) is called the rhumb line or loxodrome. Its length is <i>s12</i> and the rhumb line has a forward azimuth <i>azi12</i> along its length. Also computed is <i>S12</i> is the area between the rhumb line from point 1 to point 2 and the equator; i.e., it is the area, measured counter-clockwise, of the geodesic quadrilateral with corners (<i>lat1</i>,<i>lon1</i>), (0,<i>lon1</i>), (0,<i>lon2</i>), and (<i>lat2</i>,<i>lon2</i>). A point at a pole is treated as a point a tiny distance away from the pole on the given line of longitude. The longitude becomes indeterminate when a rhumb line passes through a pole, and <b>RhumbSolve</b> reports NaNs for the longitude and the area in this case.</p>

<p><b>NOTE:</b> the rhumb line is <b>not</b> the shortest path between two points; that is the geodesic and it is calculated by GeodSolve(1).</p>

<p><b>RhumbSolve</b> operates in one of three modes:</p>

<ol>

<li><p>By default, <b>RhumbSolve</b> accepts lines on the standard input containing <i>lat1</i> <i>lon1</i> <i>azi12</i> <i>s12</i> and prints <i>lat2</i> <i>lon2</i> <i>S12</i> on standard output. This is the direct calculation.</p>

</li>
<li><p>With the <b>-i</b> command line argument, <b>RhumbSolve</b> performs the inverse calculation. It reads lines containing <i>lat1</i> <i>lon1</i> <i>lat2</i> <i>lon2</i> and prints the values of <i>azi12</i> <i>s12</i> <i>S12</i> for the corresponding shortest rhumb lines. If the end points are on opposite meridians, there are two shortest rhumb lines and the east-going one is chosen.</p>

</li>
<li><p>Command line arguments <b>-L</b> <i>lat1</i> <i>lon1</i> <i>azi12</i> specify a rhumb line. <b>RhumbSolve</b> then accepts a sequence of <i>s12</i> values (one per line) on standard input and prints <i>lat2</i> <i>lon2</i> <i>S12</i> for each. This generates a sequence of points on a rhumb line.</p>

</li>
</ol>

<h1 id="OPTIONS">OPTIONS</h1>

<dl>

<dt id="i"><b>-i</b></dt>
<dd>

<p>perform an inverse calculation (see 2 above).</p>

</dd>
<dt id="L-lat1-lon1-azi12"><b>-L</b> <i>lat1</i> <i>lon1</i> <i>azi12</i></dt>
<dd>

<p>line mode (see 3 above); generate a sequence of points along the rhumb line specified by <i>lat1</i> <i>lon1</i> <i>azi12</i>. The <b>-w</b> flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before <b>-L</b>. (<b>-l</b> is an alternative, deprecated, spelling of this flag.)</p>

</dd>
<dt id="e-a-f"><b>-e</b> <i>a</i> <i>f</i></dt>
<dd>

<p>specify the ellipsoid via the equatorial radius, <i>a</i> and the flattening, <i>f</i>. Setting <i>f</i> = 0 results in a sphere. Specify <i>f</i> &lt; 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for <i>f</i>. By default, the WGS84 ellipsoid is used, <i>a</i> = 6378137 m, <i>f</i> = 1/298.257223563.</p>

</dd>
<dt id="d"><b>-d</b></dt>
<dd>

<p>output angles as degrees, minutes, seconds instead of decimal degrees.</p>

</dd>
<dt id="pod"><b>-:</b></dt>
<dd>

<p>like <b>-d</b>, except use : as a separator instead of the d, &#39;, and &quot; delimiters.</p>

</dd>
<dt id="w"><b>-w</b></dt>
<dd>

<p>on input and output, longitude precedes latitude (except that on input this can be overridden by a hemisphere designator, <i>N</i>, <i>S</i>, <i>E</i>, <i>W</i>).</p>

</dd>
<dt id="p-prec"><b>-p</b> <i>prec</i></dt>
<dd>

<p>set the output precision to <i>prec</i> (default 3); <i>prec</i> is the precision relative to 1 m. See <a href="#PRECISION">&quot;PRECISION&quot;</a>.</p>

</dd>
<dt id="s"><b>-s</b></dt>
<dd>

<p>By default, the rhumb line calculations are carried out exactly in terms of elliptic integrals. This includes the use of the addition theorem for elliptic integrals to compute the divided difference of the isometric and rectifying latitudes. If <b>-s</b> is supplied this divided difference is computed using Krueger series for the transverse Mercator projection which is only accurate for |<i>f</i>| &lt; 0.01. See <a href="#ACCURACY">&quot;ACCURACY&quot;</a>.</p>

</dd>
<dt id="comment-delimiter-commentdelim"><b>--comment-delimiter</b> <i>commentdelim</i></dt>
<dd>

<p>set the comment delimiter to <i>commentdelim</i> (e.g., &quot;#&quot; or &quot;//&quot;). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).</p>

</dd>
<dt id="version"><b>--version</b></dt>
<dd>

<p>print version and exit.</p>

</dd>
<dt id="h"><b>-h</b></dt>
<dd>

<p>print usage and exit.</p>

</dd>
<dt id="help"><b>--help</b></dt>
<dd>

<p>print full documentation and exit.</p>

</dd>
<dt id="input-file-infile"><b>--input-file</b> <i>infile</i></dt>
<dd>

<p>read input from the file <i>infile</i> instead of from standard input; a file name of &quot;-&quot; stands for standard input.</p>

</dd>
<dt id="input-string-instring"><b>--input-string</b> <i>instring</i></dt>
<dd>

<p>read input from the string <i>instring</i> instead of from standard input. All occurrences of the line separator character (default is a semicolon) in <i>instring</i> are converted to newlines before the reading begins.</p>

</dd>
<dt id="line-separator-linesep"><b>--line-separator</b> <i>linesep</i></dt>
<dd>

<p>set the line separator character to <i>linesep</i>. By default this is a semicolon.</p>

</dd>
<dt id="output-file-outfile"><b>--output-file</b> <i>outfile</i></dt>
<dd>

<p>write output to the file <i>outfile</i> instead of to standard output; a file name of &quot;-&quot; stands for standard output.</p>

</dd>
</dl>

<h1 id="INPUT">INPUT</h1>

<p><b>RhumbSolve</b> measures all angles in degrees, all lengths (<i>s12</i>) in meters, and all areas (<i>S12</i>) in meters^2. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees, minutes, seconds. For example, <code>40d30</code>, <code>40d30&#39;</code>, <code>40:30</code>, <code>40.5d</code>, and <code>40.5</code> are all equivalent. By default, latitude precedes longitude for each point (the <b>-w</b> flag switches this convention); however on input either may be given first by appending (or prepending) <i>N</i> or <i>S</i> to the latitude and <i>E</i> or <i>W</i> to the longitude. Azimuths are measured clockwise from north; however this may be overridden with <i>E</i> or <i>W</i>.</p>

<p>For details on the allowed formats for angles, see the <code>GEOGRAPHIC COORDINATES</code> section of GeoConvert(1).</p>

<h1 id="PRECISION">PRECISION</h1>

<p><i>prec</i> gives precision of the output with <i>prec</i> = 0 giving 1 m precision, <i>prec</i> = 3 giving 1 mm precision, etc. <i>prec</i> is the number of digits after the decimal point for lengths. For decimal degrees, the number of digits after the decimal point is <i>prec</i> + 5. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is <i>prec</i> + 1. The minimum value of <i>prec</i> is 0 and the maximum is 10.</p>

<h1 id="ERRORS">ERRORS</h1>

<p>An illegal line of input will print an error message to standard output beginning with <code>ERROR:</code> and causes <b>RhumbSolve</b> to return an exit code of 1. However, an error does not cause <b>RhumbSolve</b> to terminate; following lines will be converted.</p>

<h1 id="ACCURACY">ACCURACY</h1>

<p>The algorithm used by <b>RhumbSolve</b> uses exact formulas for converting between the latitude, rectifying latitude (<i>mu</i>), and isometric latitude (<i>psi</i>). These formulas are accurate for any value of the flattening. The computation of rhumb lines involves the ratio (<i>psi1</i> - <i>psi2</i>) / (<i>mu1</i> - <i>mu2</i>) and this is subject to large round-off errors if <i>lat1</i> is close to <i>lat2</i>. So this ratio is computed using divided differences using one of two methods: by default, this uses the addition theorem for elliptic integrals (accurate for all values of <i>f</i>); however, with the <b>-s</b> options, it is computed using the series expansions used by TransverseMercatorProj(1) for the conversions between rectifying and conformal latitudes (accurate for |<i>f</i>| &lt; 0.01). For the WGS84 ellipsoid, the error is about 10 nanometers using either method.</p>

<h1 id="EXAMPLES">EXAMPLES</h1>

<p>Route from JFK Airport to Singapore Changi Airport:</p>

<pre><code>   echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E |
   RhumbSolve -i -: -p 0

   103:34:58.2 18523563</code></pre>

<p>N.B. This is <b>not</b> the route typically taken by aircraft because it&#39;s considerably longer than the geodesic given by GeodSolve(1).</p>

<p>Waypoints on the route at intervals of 2000km:</p>

<pre><code>   for ((i = 0; i &lt;= 20; i += 2)); do echo ${i}000000;done |
   RhumbSolve -L 40:38:23N 073:46:44W 103:34:58.2 -: -p 0

   40:38:23.0N 073:46:44.0W 0
   36:24:30.3N 051:28:26.4W 9817078307821
   32:10:26.8N 030:20:57.3W 18224745682005
   27:56:13.2N 010:10:54.2W 25358020327741
   23:41:50.1N 009:12:45.5E 31321269267102
   19:27:18.7N 027:59:22.1E 36195163180159
   15:12:40.2N 046:17:01.1E 40041499143669
   10:57:55.9N 064:12:52.8E 42906570007050
   06:43:07.3N 081:53:28.8E 44823504180200
   02:28:16.2N 099:24:54.5E 45813843358737
   01:46:36.0S 116:52:59.7E 45888525219677</code></pre>

<h1 id="SEE-ALSO">SEE ALSO</h1>

<p>GeoConvert(1), GeodSolve(1), TransverseMercatorProj(1).</p>

<p>An online version of this utility is availbable at <a href="https://geographiclib.sourceforge.io/cgi-bin/RhumbSolve">https://geographiclib.sourceforge.io/cgi-bin/RhumbSolve</a>.</p>

<p>The Wikipedia page, Rhumb line, <a href="https://en.wikipedia.org/wiki/Rhumb_line">https://en.wikipedia.org/wiki/Rhumb_line</a>.</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p><b>RhumbSolve</b> was written by Charles Karney.</p>

<h1 id="HISTORY">HISTORY</h1>

<p><b>RhumbSolve</b> was added to GeographicLib, <a href="https://geographiclib.sourceforge.io">https://geographiclib.sourceforge.io</a>, in version 1.37.</p>


</body>

</html>


